<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div th:replace="pages/admin/commons/header :: header"></div>
<body>
<div class="wap-container">
    <nav class="breadcrumb" style="background-color:#fff;padding: 0 24px">
        首页
        <span class="c-gray en">/</span>
        代码维护
        <span class="c-gray en">/</span>
        单位代码
        <a class="btn btn-success radius f-r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <article class="Hui-admin-content clearfix">
        <div class="panel">
            <div class="panel-body">
                <form method="post" class="form form-horizontal" id="form1">
                    <input type="hidden" class="input-text" name="id">
                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>归属地：</label>
                        <div class="form-controls col-xs-8 col-sm-9">
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gsdsheng" id="gsdsheng">
                                    <option value="安徽省">安徽省</option>
                                    <option value="山东省">山东省</option>
                                    <option value="江西省">江西省</option>
                                </select>
                            </span>
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gsdshi">
                                    <option value="test2">test2</option>
                                    <option value="萍乡市">萍乡市</option>
                                    <option value="test3">test3</option>
                                </select>
                            </span>
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gsdxian">
                                    <option value="test3">test3</option>
                                    <option value="莲花县">莲花县</option>
                                    <option value="test4">test4</option>
                                </select>
                            </span>
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gsdzhen">
                                    <option value="test1">test1</option>
                                    <option value="test2">test2</option>
                                    <option value="test3">test3</option>
                                </select>
                            </span>
                            <!--                            <input type="text" class="input-text" value="" placeholder=""   name="">-->
                        </div>
                    </div>
                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2">单位代码：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" placeholder="单位代码" name="dwdm">
                        </div>

                        <label class="form-label col-xs-2 col-sm-1" style="margin-left: 5%">编码：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" placeholder="编码" name="bm">
                        </div>

                        <label class="form-label col-xs-2 col-sm-2">拼音编码：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" placeholder="拼音编码" name="pybm">
                        </div>
                    </div>
                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>单位名称：</label>
                        <div class="form-controls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" placeholder="单位名称" name="dwmc">
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>单位类别：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <span class="select-box">
                                <select class="select" name="dwlb">
                                </select>
                            </span>
                        </div>

                        <label class="form-label col-xs-2 col-sm-2"><span class="c-red"></span>所有制：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <span class="select-box">
                                <select class="select" name="syz">
                                </select>
                            </span>
                        </div>
                        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>行政级别：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <span class="select-box">
                                <select class="select" name="xzjb">
                                </select>
                            </span>
                            <input type="text" class="input-text" name="xzjbnum">

                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>医院类别：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <span class="select-box">
                                <select class="select" name="yylb">
                                    <option value="test1">test1</option>
                                    <option value="其他">其他</option>
                                    <option value="test3">test3</option>
                                </select>
                            </span>
                        </div>

                        <label class="form-label col-xs-2 col-sm-2"><span class="c-red"></span>医院级别：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <span class="select-box">
                                <select class="select" name="yyjb">
                                    <option value="test1">test1</option>
                                    <option value="二甲">二甲</option>
                                    <option value="test3">test3</option>
                                </select>
                            </span>
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2">法人代表：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" name="frdb">
                        </div>

                        <label class="form-label col-xs-2 col-sm-2" style="margin-left: 5%">详细地址：</label>
                        <div class="form-controls col-xs-5 col-sm-5">
                            <input type="text" class="input-text" name="xxdz">
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2">联系QQ：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" name="lianxiqq">
                        </div>

                        <label class="form-label col-xs-2 col-sm-2" style="margin-left: 5%">电子邮箱：</label>
                        <div class="form-controls col-xs-5 col-sm-5">
                            <input type="text" class="input-text" name="dzyx">
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2">邮政编码：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" name="yzbm">
                        </div>

                        <label class="form-label col-xs-2 col-sm-1" style="margin-left: 5%">联系人：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" name="lxr">
                        </div>

                        <label class="form-label col-xs-2 col-sm-2">联系电话：</label>
                        <div class="form-controls col-xs-2 col-sm-2">
                            <input type="text" class="input-text" name="lxdh">
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-2 col-sm-2">权限：</label>
                        <div class="form-controls col-xs-2 col-sm-6 skin-minimal">
                            <div class="check-box">
                                <input type="checkbox" id="dwyh" name="dwyh">
                                <label>单位用户</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="ktznkhd">
                                <label>开通智能客户端</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="jszgz">
                                <label>接生资格证</label>
                            </div>
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-2 col-sm-2">单位性质：</label>
                        <div class="form-controls col-xs-2 col-sm-8 skin-minimal">
                            <div class="check-box">
                                <input type="checkbox" name="jsdw">
                                <label>接生单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="ybdw">
                                <label>孕保单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="fsdw">
                                <label>访视单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="ebdw">
                                <label>儿保单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="jmdw">
                                <label>计免单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="sqfwzx">
                                <label>社区服务中心</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="sqfwz">
                                <label>社区服务站</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="cwss">
                                <label>村卫生室</label>
                            </div>
                        </div>
                    </div>
                    <div class="row clearfix">
                        <label class="form-label col-xs-2 col-sm-2">业务范围：</label>
                        <div class="form-controls col-xs-2 col-sm-8 skin-minimal">
                            <div class="check-box" style="width: 100%">
                                <input type="checkbox" name="qb" class="allCheck">
                                <label>全部</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="fejcda">
                                <label>妇儿基础档案</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="fnjcda">
                                <label>妇女基础档案</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="etjcda">
                                <label>儿童基础档案</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="hqbj">
                                <label>婚前保健</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="fnbpc">
                                <label>妇女病普查</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="yqyszxfw">
                                <label>孕前优生咨询服务</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="ycfbj">
                                <label>孕产妇保健</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="ycfjd">
                                <label>孕产妇建档</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="scjc">
                                <label>首次检查</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="cqfz">
                                <label>产前复诊</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="csfm">
                                <label>产时分娩</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="chfs">
                                <label>产后访视</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="xsefs">
                                <label>新生儿访视</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="ch42tjc">
                                <label>产后42天检查</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="gwgl">
                                <label>高危管理</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="cscz">
                                <label>产筛产诊</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="cqsc">
                                <label>产前筛查</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="cqzd">
                                <label>产前诊断</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="cszm">
                                <label>出生证明</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="gldw">
                                <label>管理单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="qfdw">
                                <label>签发单位</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="etbj">
                                <label>儿童保健</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="jtet">
                                <label>集体儿童</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="etzqzhfz">
                                <label>儿童早期综合发展</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="jhmy">
                                <label>计划免疫</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="gwegl">
                                <label>高危儿管理</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="jkda">
                                <label>健康档案</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="mbgl">
                                <label>慢病管理</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="tnbrgl">
                                <label>糖尿病人管理</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="gxybrgl">
                                <label>高血压病人管理</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="jsbrgl">
                                <label>精神病人管理</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" class="childrenCheck" name="lnbj">
                                <label>老年保健</label>
                            </div>
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-2 col-sm-2">状态：</label>
                        <div class="form-controls col-xs-2 col-sm-8 skin-minimal">
                            <div class="check-box">
                                <input type="checkbox" name="sd">
                                <label>锁定</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="ty">
                                <label>停用</label>
                            </div>
                        </div>
                    </div>

                    <div class="row clearfix">
                        <label class="form-label col-xs-2 col-sm-2">报表统计单位：</label>
                        <div class="form-controls col-xs-2 col-sm-8 skin-minimal">
                            <div class="check-box">
                                <input type="checkbox" name="etjbqdfxb">
                                <label>儿童疾病缺点分析表</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="jytzdtj">
                                <label>基于台账的统计(卫计统52/53/54表)</label>
                            </div>
                            <div class="check-box">
                                <input type="checkbox" name="fncjbscqk">
                                <label>妇女常见病筛查情况(卫计统55表)</label>
                            </div>
                        </div>
                    </div>


                    <div class="row clearfix">
                        <label class="form-label col-xs-2 col-sm-2">管理者：</label>
                        <div class="form-controls col-xs-2 col-sm-8 skin-minimal">
                            <div class="check-box">
                                <input type="checkbox" name="gldw2">
                                <label>管理单位</label>
                            </div>
                            <span class="select-box" style="width: 20%">
                                <select class="select" name="gldw3">
                                    <option value="test1">test1</option>
                                    <option value="test2">test2</option>
                                    <option value="区县级">区县级</option>
                                </select>
                            </span>
                        </div>
                    </div>


                    <div class="row clearfix">
                        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>管辖地：</label>
                        <div class="form-controls col-xs-8 col-sm-9">
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gxdsheng">
                                    <option value="安徽省">安徽省</option>
                                    <option value="山东省">山东省</option>
                                    <option value="江西省">江西省</option>
                                </select>
                            </span>
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gxdshi">
                                    <option value="test2">test2</option>
                                    <option value="萍乡市">萍乡市</option>
                                    <option value="test3">test3</option>
                                </select>
                            </span>
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gxdxian">
                                    <option value="test3">test3</option>
                                    <option value="莲花县">莲花县</option>
                                    <option value="test4">test4</option>
                                </select>
                            </span>
                            <span class="select-box" style="width: 20%;">
                                <select class="select" name="gxdzhen">
                                    <option>test4</option>
                                </select>
                            </span>
                            <!--                            <input type="text" class="input-text"       name="">-->
                        </div>
                    </div>
                    <div class="row clearfix" style="text-align: center">
                        <button id="sub" style=" margin-left: inherit;margin-right: 20px;"
                                class="btn btn-primary radius"
                                type="button">
                            修改
                        </button>
                        <a href="javascript:location.replace(location.href);" style=" margin-left: inherit"
                           class="btn btn-info radius">
                            取消
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </article>
</div>

<div th:replace="pages/admin/commons/footer :: footer"></div>
<script th:src="@{/layui/layui.js}" charset="utf-8"></script>

<script type="text/javascript">
    $(function () {
        // $('.skin-minimal input').iCheck({
        //     checkboxClass: 'icheckbox-blue',
        //     radioClass: 'iradio-blue',
        //     increaseArea: '20%'
        // });

        //查询下拉列表并填充
        fillOption();

        //查找并填充数据
        $.ajax({
            url: "/childhealth/xzCode/getXzCode",
            method: "post",
            success: function (result) {
                var item = result.data;
                fill(item);
                // console.log(result);

            }
        })


        //----------------------------------------------------------//

        function fill(item) {

            $("[name=id]").val(item.id);

            $("#gsdsheng").find("option").each(function () {
                if ($(this).text() == item.gsdsheng) {
                    $(this).attr("selected", true);
                }
            });

            $("[name=gsdshi]").find("option").each(function () {
                if ($(this).text() == item.gsdshi) {
                    $(this).attr("selected", true);
                }
            });
            $("[name=gsdxian]").find("option").each(function () {
                if ($(this).text() == item.gsdxian) {
                    $(this).attr("selected", true);
                }
            });
            $("[name=gsdzhen]").find("option").each(function () {
                if ($(this).text() == item.gsdzhen) {
                    $(this).attr("selected", true);
                }
            });
            $("[name=xzjb]").find("option").each(function () {
                if ($(this).text() == item.xzjb) {
                    $(this).attr("selected", true);
                }
            });

            $("[name=dwdm]").val(item.dwdm);
            $("[name=bm]").val(item.bianma);
            $("[name=pybm]").val(item.pybm);
            $("[name=dwmc]").val(item.dwmc);
            $("[name=xzjbnum]").val(item.xzjbnum);

            $("[name=yylb]").find("option").each(function () {
                if ($(this).text() == item.yylb) {
                    $(this).attr("selected", true);
                }
            });
            $("[name=yyjb]").find("option").each(function () {
                if ($(this).text() == item.yyjb) {
                    $(this).attr("selected", true);
                }
            });

            $("[name=frdb]").val(item.frdb);
            $("[name=xxdz]").val(item.xxdz);
            $("[name=lianxiqq]").val(item.lianxiqq);
            $("[name=dzyx]").val(item.dzyx);
            $("[name=yzbm]").val(item.yzbm);
            $("[name=lxr]").val(item.lxr);
            $("[name=lxdh]").val(item.lxdh);

            // $("#dwyh").parent().addClass("checked");
            $("[name=dwyh]").prop("checked", item.dwyh == 'on' ? true : false);
            $("[name=ktznkhd]").prop("checked", item.ktznkhd == 'on' ? true : false);
            $("[name=jszgz]").prop("checked", item.jszgz == 'on' ? true : false);
            $("[name=jsdw]").prop("checked", item.jsdw == 'on' ? true : false);
            $("[name=ybdw]").prop("checked", item.ybdw == 'on' ? true : false);
            $("[name=fsdw]").prop("checked", item.fsdw == 'on' ? true : false);
            $("[name=ebdw]").prop("checked", item.ebdw == 'on' ? true : false);
            $("[name=jmdw]").prop("checked", item.jmdw == 'on' ? true : false);
            $("[name=sqfwzx]").prop("checked", item.sqfwzx == 'on' ? true : false);
            $("[name=sqfwz]").prop("checked", item.sqfwz == 'on' ? true : false);
            $("[name=cwss]").prop("checked", item.cwss == 'on' ? true : false);

            $("[name=qb]").prop("checked", item.qb == 'on' ? true : false);
            $("[name=fejcda]").attr("checked", item.fejcda == 'on' ? true : false);
            $("[name=fnjcda]").prop("checked", item.fnjcda == 'on' ? true : false);
            $("[name=etjcda]").prop("checked", item.etjcda == 'on' ? true : false);
            $("[name=hqbj]").prop("checked", item.hqbj == 'on' ? true : false);
            $("[name=fnbpc]").prop("checked", item.fnbpc == 'on' ? true : false);
            $("[name=yqyszxfw]").prop("checked", item.yqyszxfw == 'on' ? true : false);
            $("[name=ycfbj]").prop("checked", item.ycfbj == 'on' ? true : false);
            $("[name=ycfjd]").prop("checked", item.ycfjd == 'on' ? true : false);
            $("[name=scjc]").prop("checked", item.scjc == 'on' ? true : false);
            $("[name=cqfz]").prop("checked", item.cqfz == 'on' ? true : false);
            $("[name=csfm]").prop("checked", item.csfm == 'on' ? true : false);
            $("[name=chfs]").prop("checked", item.chfs == 'on' ? true : false);
            $("[name=xsefs]").prop("checked", item.xsefs == 'on' ? true : false);
            $("[name=ch42tjc]").prop("checked", item.ch42tjc == 'on' ? true : false);
            $("[name=gwgl]").prop("checked", item.gwgl == 'on' ? true : false);
            $("[name=cscz]").prop("checked", item.cscz == 'on' ? true : false);
            $("[name=cqsc]").prop("checked", item.cqsc == 'on' ? true : false);
            $("[name=cqzd]").prop("checked", item.cqzd == 'on' ? true : false);
            $("[name=cszm]").prop("checked", item.cszm == 'on' ? true : false);
            $("[name=gldw]").prop("checked", item.gldw == 'on' ? true : false);
            $("[name=qfdw]").prop("checked", item.qfdw == 'on' ? true : false);
            $("[name=etbj]").prop("checked", item.etbj == 'on' ? true : false);
            $("[name=jtet]").prop("checked", item.jtet == 'on' ? true : false);
            $("[name=etzqzhfz]").prop("checked", item.etzqzhfz == 'on' ? true : false);
            $("[name=jhmy]").prop("checked", item.jhmy == 'on' ? true : false);
            $("[name=gwegl]").prop("checked", item.gwegl == 'on' ? true : false);
            $("[name=mbgl]").prop("checked", item.mbgl == 'on' ? true : false);
            $("[name=jkda]").prop("checked", item.jkda == 'on' ? true : false);
            $("[name=tnbrgl]").prop("checked", item.tnbrgl == 'on' ? true : false);
            $("[name=gxybrgl]").prop("checked", item.gxybrgl == 'on' ? true : false);
            $("[name=jsbrgl]").prop("checked", item.jsbrgl == 'on' ? true : false);
            $("[name=lnbj]").prop("checked", item.lnbj == 'on' ? true : false);
            $("[name=sd]").prop("checked", item.sd == 'on' ? true : false);
            $("[name=ty]").prop("checked", item.ty == 'on' ? true : false);
            $("[name=etjbqdfxb]").prop("checked", item.etjbqdfxb == 'on' ? true : false);
            $("[name=jytzdtj]").prop("checked", item.jytzdtj == 'on' ? true : false);
            $("[name=fncjbscqk]").prop("checked", item.fncjbscqk == 'on' ? true : false);
            $("[name=gldw2]").prop("checked", item.gldw2 == 'on' ? true : false);


            $("[name=gldw3]").find("option").each(function () {
                if ($(this).text() == item.gldw3) {
                    $(this).attr("selected", true);
                }
            });

            $("[name=gxdsheng]").find("option").each(function () {
                if ($(this).text() == item.gxdsheng) {
                    $(this).attr("selected", true);
                }
            });

            $("[name=gxdshi]").find("option").each(function () {
                if ($(this).text() == item.gxdshi) {
                    $(this).attr("selected", true);
                }
            });
            $("[name=gxdxian]").find("option").each(function () {
                if ($(this).text() == item.gxdxian) {
                    $(this).attr("selected", true);
                }
            });
            $("[name=gxdzhen]").find("option").each(function () {
                if ($(this).text() == item.gxdzhen) {
                    $(this).attr("selected", true);
                }
            });

        }

        function fillOption() {
            $.ajax({
                url: "/childhealth/dataDictionary/getNodeInfo/36",//36是数据词典里的单位类别
                method: "POST",
                success: function (result) {
                    $.each(result.data, function (index, item) {
                        var opt = $("<option value='" + item.value + "'></option>").append(item.value);
                        $("[name=dwlb]").append(opt);
                    })
                }
            });
            $.ajax({
                url: "/childhealth/dataDictionary/getNodeInfo/59",
                method: "POST",
                success: function (result) {
                    $.each(result.data, function (index, item) {
                        var opt = $("<option value='" + item.value + "'></option>").append(item.value);
                        $("[name=syz]").append(opt);
                    })
                }
            });
            //行政级别//数据还没添加
            // $.ajax({
            //     url: "/childhealth/dataDictionary/getNodeInfo/?",
            //     method: "POST",
            //     success: function (result) {
            //         $.each(result.data, function (index, item) {
            //             var opt = $("<option value='" + item.value + "'></option>").append(item.value);
            //             $("[name=xzjb]").append(opt);
            //         })
            //     }
            // });


            //医院类别//数据还没添加
            // $.ajax({
            //     url: "/childhealth/dataDictionary/getNodeInfo/?",
            //     method: "POST",
            //     success: function (result) {
            //         $.each(result.data, function (index, item) {
            //             var opt = $("<option value='" + item.value + "'></option>").append(item.value);
            //             $("[name=yylb]").append(opt);
            //         })
            //     }
            // });

            //医院级别//数据还没添加
            // $.ajax({
            //     url: "/childhealth/dataDictionary/getNodeInfo/?",
            //     method: "POST",
            //     success: function (result) {
            //         $.each(result.data, function (index, item) {
            //             var opt = $("<option value='" + item.value + "'></option>").append(item.value);
            //             $("[name=yyjb]").append(opt);
            //         })
            //     }
            // });

        }


        $("#sub").click(function () {

            layer.confirm('是否确定修改？', {
                btn: ['修改', '取消'] //按钮
            }, function () {
                var list = $("#form1").serializeArray();
                var dataStr = "{";
                for (var i = 0; i < list.length; i++) {
                    var nameT = list[i].name;
                    var valueT = list[i].value;
                    dataStr = dataStr + "\"" + nameT + "\":\"" + valueT.trim() + "\",";
                }
                dataStr = dataStr.substring(0, dataStr.length - 1); //去掉最后一个属性的逗号
                dataStr = dataStr + "}";
                var dataJson = JSON.parse(dataStr);
                console.log(dataJson);

                $.ajax({
                    url: "/childhealth/xzCode/upd",
                    method: "post",
                    contentType: "application/json;charset=UTF-8",
                    dataType: "json",
                    async: false,
                    cache: false,
                    data: JSON.stringify(dataJson),
                    success: function (result) {
                        if (result.code == 0) {
                            layer.msg('修改成功！', {icon: 1});
                            setTimeout(function () {
                                location.replace(location.href)
                            }, 1000)
                        } else {
                            layer.msg('修改失败！', {icon: 5});
                        }
                    }
                });

            });

            return false;
        });

        //全选按钮

        //childrenCheck allCheck

        $(".allCheck").click(function () {
            if ($(".allCheck").is(':checked')) {
                $(".childrenCheck").prop("checked", true);
            }

        });

        $("input[class=childrenCheck]").change(function () {
            var allCount = $("input[class=childrenCheck]").length;
            var chooseCount = $(".childrenCheck:checked").length;
            if (allCount == chooseCount) {
                $(".allCheck").prop("checked", true);
            } else {
                $(".allCheck").prop("checked", false);
            }
        });

    });
</script>
</body>
</html>
